var myChart = echarts.init(document.getElementById("b1"));
var option = {
    title: {
        text: '3D图形--沈林涛',
    },
        grid3D: {},
        xAxis3D: {},
        yAxis3D: {},
        zAxis3D: {},
        series:[{
            type:'scatter3D',
            data:[[1,1,1],[2,3,4]],
        }],
};
//画图
myChart.setOption(option);
//---------------------------------------
var dataSet = [];
for(var i=0;i<100;i++){
    var x = Math.floor(100*Math.random());
    var y = Math.floor(100*Math.random());
    var z = Math.floor(100*Math.random());
    dataSet.push([x,y,z])
}
var myChart2 = echarts.init(document.getElementById("b2"));
var option2 = {
    title: {
        text: '3D散点图形--沈林涛',
    },
        grid3D: {},
        xAxis3D: {},
        yAxis3D: {},
        zAxis3D: {},
        series:[{
            type:'scatter3D',
            data:dataSet,
            symbolSize: function(data){
                return data[2]/6+10;
            },
            itemStyle: {
                color: function(value){
                    var v1 = Math.round(value.data[0]/100*255);
                    var v2 = Math.round(value.data[1]/100*255);
                    var v3 = Math.round(value.data[2]/100*255);
                    return 'rgb('+v1+','+v2+','+v3+')'
                },
            },
        }],
};
//画图
myChart2.setOption(option2);
//---------------------------------------
var dataSet = [];
for(var i=0;i<100;i++){
    var x = Math.floor(100*Math.random());
    var y = Math.floor(100*Math.random());
    var z = Math.floor(100*Math.random());
    dataSet.push([x,y,z])
}
var myChart3 = echarts.init(document.getElementById("b3"));
var option3 = {
    title: {
        text: '3D柱状图形--沈林涛',
    },
        grid3D: {},
        xAxis3D: {},
        yAxis3D: {},
        zAxis3D: {},
        visualMap: {
            min:1,
            max:100,
            calculable:'true',
            inRange:{
                color:['black','red','green']
            },
        },
        series:[{
            type:'bar3D',
            data:dataSet,
            // symbolSize: function(data){
            //     return data[2]/6+10;
            // },
            itemStyle: {
                color: function(value){
                    var v1 = Math.round(value.data[0]/100*255);
                    var v2 = Math.round(value.data[1]/100*255);
                    var v3 = Math.round(value.data[2]/100*255);
                    return 'rgb('+v1+','+v2+','+v3+')'
                },
            },
        }],
};
//画图
myChart3.setOption(option3);
//---------------------------------------
var dataSet4 = [];
for(var i=0;i<1000;i++){
    var x = Math.sin(i)*Math.cos(i);
    var y = Math.cos(i)*Math.sin(i);
    var z = Math.cos(i);
    dataSet4.push([x,y,z])
}
var myChart4 = echarts.init(document.getElementById("b4"));
var option4 = {
    title: {
        text: '3D散点图形--沈林涛',
    },
        grid3D: {},
        xAxis3D: {},
        yAxis3D: {},
        zAxis3D: {},
        series: [
            {
              type: 'line3D',
              data:dataSet4,
            }
          ]
};
//画图
myChart4.setOption(option4);
//---------------------------------------
var dataSet4 = [];
for(var i=0;i<100;i++){
    var x = Math.sin(i)*Math.cos(i);
    var y = Math.cos(i)*Math.sin(i);
    var z = Math.cos(i);
    dataSet4.push([x,y,z])
}
var myChart5 = echarts.init(document.getElementById("b5"));
var option5 = {
    title: {
        text: '3D散点图形--沈林涛',
    },
        grid3D: {},
        visualMap: [{}],
        xAxis3D: {},
        yAxis3D: {},
        zAxis3D: {},
        series: [
            {
              type: 'surface',
              equation: {
                  x: {
                      step: 0.1,
                      max: 3,
                      min: -3,
                  },
                  y: {
                    step: 0.1,
                    max: 3,
                    min: -3,
                },
                z: function (x, y) {
                    return x*x + y*y;
                }
              },
    }]
};
//画图
myChart5.setOption(option5);
//---------------------------------------
var dataSet4 = [];
for(var i=0;i<100;i++){
    var x = Math.sin(i)*Math.cos(i);
    var y = Math.cos(i)*Math.sin(i);
    var z = Math.cos(i);
    dataSet4.push([x,y,z])
}
var myChart6 = echarts.init(document.getElementById("b6"));
var option6 = {
    title: {
        text: '3D散点图形--沈林涛',
    },
        grid3D: {},
        visualMap: [{}],
        xAxis3D: {},
        yAxis3D: {},
        zAxis3D: {},
        series: [
            {
              type: 'surface',
              parametric: true,
              parametricEquation: {
                u: {
                    min: -Math.PI,
                    max: Math.PI,
                    step: Math.PI / 20
                  },
                  v: {
                    min: 0,
                    max: Math.PI,
                    step: Math.PI / 20
                  },
                x: function (u, v) {
                    return Math.sin(v) * Math.sin(u);
                  },
                  y: function (u, v) {
                    return Math.sin(v) * Math.cos(u);
                  },
                  z: function (u, v) {
                    return Math.cos(v);
                  }
              },
    }]
};
//画图
myChart6.setOption(option6);